package com.sls.game.parser.ohfei;

import java.io.StringReader;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.apache.log4j.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;

import com.sls.game.pojo.OhFeiGoodsAreaServerInfo;
import com.sls.game.pojo.OhFeiGoodsInfo;
import com.sls.game.pojo.OhFeiResponseInfo;
import com.sls.game.pojo.OhFeiTradeInfo;

/**
 * 
 * @description 以Document方式解析xml字符串<br>
 *              品牌同步解析
 * @author Wangxuegang
 * @date 2012-9-28
 * 
 */
public class OhFeiResOfDomParseXml {

	private static Logger log = Logger.getLogger(OhFeiResOfDomParseXml.class);

	/**
	 * 对返回的xml格式字符串数据进行解析<br>
	 * 解析品牌信息
	 * 
	 * @param xmlStr
	 * @return
	 */
	public static Map<String, Object> parseXmlOfBrandString(String xmlStr) {

		List<OhFeiResponseInfo> resList = new ArrayList<OhFeiResponseInfo>();
		OhFeiResponseInfo infoError = new OhFeiResponseInfo();
		Map<String, Object> map = new HashMap<String, Object>();
		String err_msg = "";
		String retcode = "";

		InputSource source = null;
		StringReader read = null;

		try {
			// 得到DOM解析器的工厂实例
			DocumentBuilderFactory dbFactory = DocumentBuilderFactory
					.newInstance();
			// 从DOM工厂中获得DOM解析器
			DocumentBuilder dbBuilder = dbFactory.newDocumentBuilder();

			read = new StringReader(xmlStr);
			source = new InputSource(read);

			// 把要解析的xml文档读入DOM解析器
			Document doc = dbBuilder.parse(source);
			Element root = doc.getDocumentElement();
//			log.info("根元素：" + root.getNodeName());

			NodeList childNodes = root.getChildNodes(); // 获得根元素下的子节点

			// 遍历子节点
			for (int i = 0; i < childNodes.getLength(); i++) {
				Node node = childNodes.item(i); // 对每个子节点进行判断
				if ("err_msg".equals(node.getNodeName())) { // 第二层节点
					err_msg = node.getTextContent();
					infoError.setErr_msg(err_msg);
				} else if ("retcode".equals(node.getNodeName())) { // 第二层节点
					retcode = node.getTextContent();
					infoError.setRetcode(retcode);
				} else if ("ret_cardinfos".equals(node.getNodeName())) { // 第二层节点
					Element thirdChildNode = (Element) node.getChildNodes();

					NodeList grandsonNodes = thirdChildNode.getChildNodes();
					for (int j = 0; j < grandsonNodes.getLength(); j++) { // ==============循环读取多个card节点
						OhFeiResponseInfo info = new OhFeiResponseInfo();
						info.setErr_msg(infoError.getErr_msg());
						info.setRetcode(infoError.getRetcode());

						Node grandsonNode = grandsonNodes.item(j);
						if ("card".equals(grandsonNode.getNodeName())) {
							Element grandson = (Element) grandsonNode
									.getChildNodes(); // 第三层节点
							NodeList grandsonChildNodes = grandson
									.getChildNodes(); // 获得第三层元素下的子节点

							for (int k = 0; k < grandsonChildNodes.getLength(); k++) {
								Node grandsonChildnode = grandsonChildNodes
										.item(k);
								if ("cardid".equals(grandsonChildnode
										.getNodeName())) { // 第四层节点
									String cardId = grandsonChildnode
											.getTextContent();
									info.setCardid(cardId);

								} else if ("classid".equals(grandsonChildnode
										.getNodeName())) {
									String classId = grandsonChildnode
											.getTextContent();
									info.setClassid(classId);

								} else if ("cardname".equals(grandsonChildnode
										.getNodeName())) {
									String cardName = grandsonChildnode
											.getTextContent();
									info.setCardname(cardName);

								} else if ("detail".equals(grandsonChildnode
										.getNodeName())) {
									String str = grandsonChildnode
											.getTextContent();
									String detail = URLDecoder.decode(str,
											"GB2312");
									info.setDetail(detail);

								} else if ("compty".equals(grandsonChildnode
										.getNodeName())) {
									String str = grandsonChildnode
											.getTextContent();
									String compty = URLDecoder.decode(str,
											"GB2312");
									info.setCompty(compty);

								} else if ("usecity".equals(grandsonChildnode
										.getNodeName())) {
									String usecity = grandsonChildnode
											.getTextContent();
									info.setUsecity(usecity);

								} else if ("usemethod".equals(grandsonChildnode
										.getNodeName())) {
									String str = grandsonChildnode
											.getTextContent();
									String useMethod = URLDecoder.decode(str,
											"GB2312");
									info.setUsemethod(useMethod);

								} else if ("fullcostsite"
										.equals(grandsonChildnode.getNodeName())) {
									String fullCostsite = grandsonChildnode
											.getTextContent();
									info.setFullcostsite(fullCostsite);

								} else if ("proare".equals(grandsonChildnode
										.getNodeName())) {
									String proare = grandsonChildnode
											.getTextContent();
									info.setProare(proare);

								} else if ("serviceNum"
										.equals(grandsonChildnode.getNodeName())) {
									String str = grandsonChildnode
											.getTextContent();
									String serviceNum = URLDecoder.decode(str,
											"GB2312");
									info.setServiceNum(serviceNum);
								}
							}
						}

						resList.add(info);
					}
				}
			}

		} catch (Exception e) {
			log.error(e);
		}

		map.put("infoError", infoError);
		map.put("resList", resList);
		
		return map;
	}

	/**
	 * 对返回的xml格式字符串数据进行解析<br>
	 * 解析具体商品信息
	 * 
	 * @param xmlStr
	 * @return
	 */
	public static Map<String, Object> parseXmlOfGoodsString(String xmlStr) {
		List<OhFeiGoodsInfo> resList = new ArrayList<OhFeiGoodsInfo>();
		OhFeiGoodsInfo infoError = new OhFeiGoodsInfo();
		Map<String, Object> map = new HashMap<String, Object>();
		String err_msg = "";
		String retcode = "";

		InputSource source = null;
		StringReader read = null;
		try {
			// 得到DOM解析器的工厂实例
			DocumentBuilderFactory dbFactory = DocumentBuilderFactory
					.newInstance();
			// 从DOM工厂中获得DOM解析器
			DocumentBuilder dbBuilder = dbFactory.newDocumentBuilder();

			read = new StringReader(xmlStr);
			source = new InputSource(read);

			// 把要解析的xml文档读入DOM解析器
			Document doc = dbBuilder.parse(source);
			Element root = doc.getDocumentElement();
//			log.info("根元素：" + root.getNodeName());

			NodeList childNodes = root.getChildNodes(); // 获得根元素下的子节点

			// 遍历子节点
			for (int i = 0; i < childNodes.getLength(); i++) {
				Node node = childNodes.item(i); // 对每个子节点进行判断
				if ("err_msg".equals(node.getNodeName())) { // 第二层节点
					err_msg = node.getTextContent();
					infoError.setErr_msg(err_msg);
				} else if ("retcode".equals(node.getNodeName())) { // 第二层节点
					retcode = node.getTextContent();
					infoError.setRetcode(retcode);
				} else if ("ret_cardinfos".equals(node.getNodeName())) { // 第二层节点
					Element thirdChildNode = (Element) node.getChildNodes();

					NodeList grandsonNodes = thirdChildNode.getChildNodes();
					for (int j = 0; j < grandsonNodes.getLength(); j++) { // ==============循环读取多个card节点
						OhFeiGoodsInfo info = new OhFeiGoodsInfo();
						info.setErr_msg(infoError.getErr_msg());
						info.setRetcode(infoError.getRetcode());

						Node grandsonNode = grandsonNodes.item(j);
						if ("card".equals(grandsonNode.getNodeName())) {
							Element grandson = (Element) grandsonNode
									.getChildNodes(); // 第三层节点
							NodeList grandsonChildNodes = grandson
									.getChildNodes(); // 获得第三层元素下的子节点

							for (int k = 0; k < grandsonChildNodes.getLength(); k++) {
								Node grandsonChildnode = grandsonChildNodes
										.item(k);
								if ("cardid".equals(grandsonChildnode
										.getNodeName())) { // 第四层节点
									String cardId = grandsonChildnode
											.getTextContent();
									info.setCardid(cardId);
								} else if ("pervalue".equals(grandsonChildnode
										.getNodeName())) { // 第四层节点
									String parvalue = grandsonChildnode
											.getTextContent();
									info.setParValue(parvalue);
								} else if ("inprice".equals(grandsonChildnode
										.getNodeName())) { // 第四层节点
									String goodsInPrice = grandsonChildnode
											.getTextContent();
									info.setGoodsInPrice(goodsInPrice);
								} else if ("sysddprice"
										.equals(grandsonChildnode.getNodeName())) { // 第四层节点
									String sysddPrice = grandsonChildnode
											.getTextContent(); // 单位;厘
									info.setSysddPrice(sysddPrice);
								} else if ("sysdd1price"
										.equals(grandsonChildnode.getNodeName())) { // 第四层节点
									String sysdd1Price = grandsonChildnode
											.getTextContent(); // 单位;厘
									info.setSysdd1Price(sysdd1Price);
								} else if ("sysdd2price"
										.equals(grandsonChildnode.getNodeName())) { // 第四层节点
									String sysdd2Price = grandsonChildnode
											.getTextContent(); // 单位;厘
									info.setSysdd2Price(sysdd2Price);
								} else if ("memberprice"
										.equals(grandsonChildnode.getNodeName())) { // 第四层节点
									String memberPrice = grandsonChildnode
											.getTextContent(); // 单位;厘
									info.setMemberPrice(memberPrice);
								} else if ("innum".equals(grandsonChildnode
										.getNodeName())) { // 第四层节点
									// String innum = grandsonChildnode
									// .getTextContent();
									// info.setAmounts(amounts);
								} else if ("cardname".equals(grandsonChildnode
										.getNodeName())) { // 第四层节点
									String goodsName = grandsonChildnode
											.getTextContent();
									info.setGoodsName(goodsName);
								} else if ("othername".equals(grandsonChildnode
										.getNodeName())) { // 第四层节点
									String goodsAlias = grandsonChildnode
											.getTextContent();
									info.setGoodsAlias(goodsAlias);
								} else if ("howeasy".equals(grandsonChildnode
										.getNodeName())) { // 第四层节点
									// String howeasy = grandsonChildnode
									// .getTextContent();
									// info.setCardId(cardId);
								} else if ("amounts".equals(grandsonChildnode
										.getNodeName())) { // 第四层节点
									String amounts = grandsonChildnode
											.getTextContent();
									info.setAmounts(amounts);
								} else if ("subclassid"
										.equals(grandsonChildnode.getNodeName())) { // 第四层节点
									String subClassId = grandsonChildnode
											.getTextContent();
									info.setSubClassId(subClassId);
								} else if ("classtype".equals(grandsonChildnode
										.getNodeName())) { // 第四层节点
									String classType = grandsonChildnode
											.getTextContent();
									info.setClassType(classType);
								} else if ("fullcostsite"
										.equals(grandsonChildnode.getNodeName())) { // 第四层节点
									String fullCostsite = grandsonChildnode
											.getTextContent();
									info.setFullCostsite(fullCostsite);
								} else if ("caption".equals(grandsonChildnode
										.getNodeName())) { // 第四层节点
									String caption = grandsonChildnode
											.getTextContent();
									caption = URLDecoder.decode(caption,
											"GB2312");
									info.setCaption(caption);
								} else if ("lastreftime"
										.equals(grandsonChildnode.getNodeName())) { // 第四层节点
									String importTime = grandsonChildnode
											.getTextContent();
									info.setImportTime(importTime);
								} else if ("accountdesc"
										.equals(grandsonChildnode.getNodeName())) { // 第四层节点
									String accountDesc = grandsonChildnode
											.getTextContent();
									info.setAccountDesc(accountDesc);
								}
							}
						}

						resList.add(info);
					}
				}
			}
		} catch (Exception e) {
			log.error(e);
		}

		map.put("infoError", infoError);
		map.put("resList", resList);

		return map;
	}

	/**
	 * 对返回的xml格式字符串数据进行解析<br>
	 * 解析区服信息
	 * 
	 * @param xmlStr
	 * @return
	 */
	public static List<OhFeiGoodsAreaServerInfo> parseXmlOfAreaServerString(
			String xmlStr) {
		List<OhFeiGoodsAreaServerInfo> resList = new ArrayList<OhFeiGoodsAreaServerInfo>();
		InputSource source = null;
		StringReader read = null;
		try {
			// 得到DOM解析器的工厂实例
			DocumentBuilderFactory dbFactory = DocumentBuilderFactory
					.newInstance();
			// 从DOM工厂中获得DOM解析器
			DocumentBuilder dbBuilder = dbFactory.newDocumentBuilder();

			read = new StringReader(xmlStr);
			source = new InputSource(read);

			// 把要解析的xml文档读入DOM解析器
			Document doc = dbBuilder.parse(source);
			Element root = doc.getDocumentElement();
			// System.out.println("根元素：" + root.getNodeName());

			NodeList childNodes = root.getChildNodes(); // 获得根元素下的子节点
			for (int i = 0; i < childNodes.getLength(); i++) {
				OhFeiGoodsAreaServerInfo info = new OhFeiGoodsAreaServerInfo();

				Node node = childNodes.item(i); // 对每个子节点进行判断
				if ("ROW".equals(node.getNodeName())) { // 第二层节点
					Element secondChildNode = (Element) node.getChildNodes();
					NodeList secondChildNodes = secondChildNode.getChildNodes(); // 获得第三层元素下的子节点
					for (int j = 0; j < secondChildNodes.getLength(); j++) {
						Node grandsonChildnode = secondChildNodes.item(j);
						if ("GAMEID".equals(grandsonChildnode.getNodeName())) {
							String gameId = grandsonChildnode.getTextContent();
							info.setGameId(gameId);
						} else if ("GAMENAME".equals(grandsonChildnode
								.getNodeName())) {
							String gameName = grandsonChildnode
									.getTextContent();
							info.setGameName(gameName);
						} else if ("AREA".equals(grandsonChildnode
								.getNodeName())) {
							String area = grandsonChildnode.getTextContent();
							info.setArea(area);
						} else if ("SERVER".equals(grandsonChildnode
								.getNodeName())) {
							String server = grandsonChildnode.getTextContent();
							info.setServer(server);
						} else if ("SX".equals(grandsonChildnode.getNodeName())) {
							String sx = grandsonChildnode.getTextContent();
							info.setSx(sx);
						} else if ("AREAFLAG".equals(grandsonChildnode
								.getNodeName())) {
							String areaFlag = grandsonChildnode
									.getTextContent();
							info.setAreaFlag(areaFlag);
						} else if ("SERVERFLAG".equals(grandsonChildnode
								.getNodeName())) {
							String serverFlag = grandsonChildnode
									.getTextContent();
							info.setServerFlag(serverFlag);
						}
					}
				}

				resList.add(info);
			}
		} catch (Exception e) {
			log.error(e);
		}

		return resList;
	}

	/**
	 * 对返回的xml格式字符串数据进行解析<br>
	 * 解析卡密充值返回消息
	 * 
	 * @param xmlStr
	 * @return
	 */
	public static List<OhFeiTradeInfo> parseXmlOfCardTradeString(String xmlStr) {
		List<OhFeiTradeInfo> resList = new ArrayList<OhFeiTradeInfo>();
		OhFeiTradeInfo info1 = new OhFeiTradeInfo();
		String err_msg = "";
		String retcode = "";
		String orderid = "";
		String cardid = "";
		String cardnum = "";
		String ordercash = "";
		String cardname = "";
		String sporder_id = "";

		InputSource source = null;
		StringReader read = null;
		try {
			// 得到DOM解析器的工厂实例
			DocumentBuilderFactory dbFactory = DocumentBuilderFactory
					.newInstance();
			// 从DOM工厂中获得DOM解析器
			DocumentBuilder dbBuilder = dbFactory.newDocumentBuilder();

			read = new StringReader(xmlStr);
			source = new InputSource(read);

			// 把要解析的xml文档读入DOM解析器
			Document doc = dbBuilder.parse(source);
			Element root = doc.getDocumentElement();
			NodeList childNodes = root.getChildNodes(); // 获得根元素下的子节点

			// 遍历子节点
			for (int i = 0; i < childNodes.getLength(); i++) {
				Node node = childNodes.item(i); // 对每个子节点进行判断
				if ("err_msg".equals(node.getNodeName())) { // 第二层节点
					err_msg = node.getTextContent();
					info1.setErr_msg(err_msg);
				} else if ("retcode".equals(node.getNodeName())) { // 第二层节点
					retcode = node.getTextContent();
					info1.setRetcode(retcode);
				} else if ("orderid".equals(node.getNodeName())) { // 第二层节点
					orderid = node.getTextContent();
					info1.setOrderid(orderid);
				} else if ("cardid".equals(node.getNodeName())) { // 第二层节点
					cardid = node.getTextContent();
					info1.setCardid(cardid);
				} else if ("cardnum".equals(node.getNodeName())) { // 第二层节点
					cardnum = node.getTextContent();
					info1.setCardnum(cardnum);
				} else if ("ordercash".equals(node.getNodeName())) { // 第二层节点
					ordercash = node.getTextContent();
					info1.setOrdercash(ordercash);
				} else if ("cardname".equals(node.getNodeName())) { // 第二层节点
					cardname = node.getTextContent();
					info1.setCardname(cardname);
				} else if ("sporder_id".equals(node.getNodeName())) { // 第二层节点
					sporder_id = node.getTextContent();
					info1.setSporder_id(sporder_id);
				} else if ("cards".equals(node.getNodeName())) { // 第二层节点
					Element thirdChildNode = (Element) node.getChildNodes();
					NodeList grandsonNodes = thirdChildNode.getChildNodes();
					for (int j = 0; j < grandsonNodes.getLength(); j++) { // ==============循环读取多个card节点
						OhFeiTradeInfo info = new OhFeiTradeInfo();
						info.setErr_msg(err_msg);
						info.setRetcode(retcode);
						info.setOrderid(orderid);
						info.setCardid(cardid);
						info.setCardnum(cardnum);
						info.setOrdercash(ordercash);
						info.setCardname(cardname);
						info.setSporder_id(sporder_id);

						Node grandsonNode = grandsonNodes.item(j);
						if ("card".equals(grandsonNode.getNodeName())) {
							Element grandson = (Element) grandsonNode
									.getChildNodes(); // 第三层节点
							NodeList grandsonChildNodes = grandson
									.getChildNodes(); // 获得第三层元素下的子节点

							for (int k = 0; k < grandsonChildNodes.getLength(); k++) {
								Node grandsonChildnode = grandsonChildNodes
										.item(k);
								if ("cardno".equals(grandsonChildnode
										.getNodeName())) { // 第四层节点
									String cardno = grandsonChildnode
											.getTextContent();
									info.setCardno(cardno);
								} else if ("cardpws".equals(grandsonChildnode
										.getNodeName())) {
									String cardpws = grandsonChildnode
											.getTextContent();
									info.setCardpws(cardpws);
								} else if ("expiretime"
										.equals(grandsonChildnode.getNodeName())) {
									String expiretime = grandsonChildnode
											.getTextContent();
									info.setExpiretime(expiretime);
								}
							}
						}

						resList.add(info);
					}
				}
			}
		} catch (Exception e) {
			log.error(e);
		}
		
		if (resList == null || resList.size() == 0) {
			resList.add(info1);
		}

		return resList;
	}

	/**
	 * 对返回的xml格式字符串数据进行解析<br>
	 * 解析区服信息
	 * 
	 * @param xmlStr
	 * @return
	 */
	public static OhFeiTradeInfo parseXmlOfDirectRechargeString(String xmlStr) {
		String err_msg = "";
		String retcode = "";
		String orderid = "";
		String cardid = "";
		String cardnum = "";
		String ordercash = "";
		String cardname = "";
		String sporder_id = "";
		String game_userid = "";
		String game_area = "";
		String game_srv = "";
		String game_state = "";

		InputSource source = null;
		StringReader read = null;
		try {
			// 得到DOM解析器的工厂实例
			DocumentBuilderFactory dbFactory = DocumentBuilderFactory
					.newInstance();
			// 从DOM工厂中获得DOM解析器
			DocumentBuilder dbBuilder = dbFactory.newDocumentBuilder();

			read = new StringReader(xmlStr);
			source = new InputSource(read);

			// 把要解析的xml文档读入DOM解析器
			Document doc = dbBuilder.parse(source);
			Element root = doc.getDocumentElement();
			NodeList childNodes = root.getChildNodes(); // 获得根元素下的子节点

			OhFeiTradeInfo info = new OhFeiTradeInfo();
			// 遍历子节点
			for (int i = 0; i < childNodes.getLength(); i++) {
				Node node = childNodes.item(i); // 对每个子节点进行判断
				if ("err_msg".equals(node.getNodeName())) { // 第二层节点
					err_msg = node.getTextContent();
					info.setErr_msg(err_msg);

				} else if ("retcode".equals(node.getNodeName())) { // 第二层节点
					retcode = node.getTextContent();
					info.setRetcode(retcode);

				} else if ("orderid".equals(node.getNodeName())) { // 第二层节点
					orderid = node.getTextContent();
					info.setOrderid(orderid);

				} else if ("cardid".equals(node.getNodeName())) { // 第二层节点
					cardid = node.getTextContent();
					info.setCardid(cardid);

				} else if ("cardnum".equals(node.getNodeName())) { // 第二层节点
					cardnum = node.getTextContent();
					info.setCardnum(cardnum);

				} else if ("ordercash".equals(node.getNodeName())) { // 第二层节点
					ordercash = node.getTextContent();
					info.setOrdercash(ordercash);

				} else if ("cardname".equals(node.getNodeName())) { // 第二层节点
					cardname = node.getTextContent();
					info.setCardname(cardname);

				} else if ("sporder_id".equals(node.getNodeName())) { // 第二层节点
					sporder_id = node.getTextContent();
					info.setSporder_id(sporder_id);

				} else if ("game_userid".equals(node.getNodeName())) { // 第二层节点
					game_userid = node.getTextContent();
					info.setGame_userid(game_userid);

				} else if ("game_area".equals(node.getNodeName())) { // 第二层节点
					game_area = node.getTextContent();
					info.setGame_area(game_area);

				} else if ("game_srv".equals(node.getNodeName())) { // 第二层节点
					game_srv = node.getTextContent();
					info.setGame_srv(game_srv);

				} else if ("game_state".equals(node.getNodeName())) { // 第二层节点
					game_state = node.getTextContent();
					info.setGame_state(game_state);
				}
			}

			return info;

		} catch (Exception e) {
			log.error(e);
		}

		return null;
	}

	// public static void main(String[] args) {
	// StringBuffer strbuf = new StringBuffer();
	// strbuf.append("<?xml version=\"1.0\" encoding=\"GB2312\" ?>");
	// strbuf.append("<orderinfo>");
	//
	// strbuf.append("<err_msg/>");
	// strbuf.append("<retcode>1</retcode>");
	// strbuf.append("<orderid>S0703300003</orderid>");
	// strbuf.append("<cardid>221201</cardid>");
	// strbuf.append("<cardnum>1</cardnum>");
	// strbuf.append("<ordercash>1</ordercash>");
	// strbuf.append("<cardname>剑侠情缘II15元直充</cardname>");
	// strbuf.append("<sporder_id>2443</sporder_id>");
	// strbuf.append("<game_userid>ybb</game_userid>");
	// strbuf.append("<game_area>三区</game_area>");
	// strbuf.append("<game_srv>天下一家</game_srv>");
	// strbuf.append("<game_state>0</game_state>");
	//
	// strbuf.append("<card>");
	// strbuf.append("<cardno>you</cardno>");
	// strbuf.append("<cardpws>success</cardpws>");
	// strbuf.append("<expiretime>4000-12-31</expiretime>");
	// strbuf.append("</card>");
	//
	// strbuf.append("</cards>");
	// strbuf.append("</orderinfo>");

	//
	// strbuf.append("<ROW>");
	// strbuf.append("<GAMEID>221605</GAMEID>");
	// strbuf.append("<GAMENAME>梦幻国度</GAMENAME>");
	// strbuf.append("<AREA>南方蜜月区</AREA>");
	// strbuf.append("<SERVER>黄金牛</SERVER>");
	// strbuf.append("<SX>1469</SX>");
	// strbuf.append("<AREAFLAG />");
	// strbuf.append("<SERVERFLAG />");
	// strbuf.append("</ROW>");
	//
	//
	// strbuf.append("</ROWDATA>");

	// strbuf.append("<cardid>2303</cardid>");
	// strbuf.append("<classid>23</classid>");
	// strbuf.append("<cardname>劲舞挂机宝贝</cardname>");
	// strbuf.append("<detail>%B9%D2%BB%FA%B1%A6%B1%B4%CF%B5%C1%D0%CA%C7%D2%BB%BF%EE%C2%CC%C9%AB%B5%C4%CD%F8%D3%CE%B8%A8%D6%FA%B9%A4%BE%DF%A3%AC%CB%FC%B2%C9%D3%C3 %AC%B1%BE%C8%ED%BC%FE%D7%F7%CE%AA%D2%BB%BF%EE%C2%CC%C9%AB%B5%C4%B9%A4%BE%DF%A3%AC%D6%BB%C6%F0%B5%BD%B8%A8%D6%FA%B5%C4%D7%F7%D3%C3%A1%A3</detail>");
	// strbuf.append("<compty>35%D4%AA%2F%D4%C2</compty>");
	// strbuf.append("<usecity>全国</usecity>");
	// strbuf.append("<usemethod>%B3%E4%D6%B5%B5%D8%D6%B7%A3%Bahttp%3A%2F%2Fwww.guajibaobei.com%2Fchongzhi.htm%3C%2Fbr%3E%0D%0A%B9%D9%B7%BD%CD%F8%D5%BE%A3%Bahttp%3A%2F%2Fwww.guajibaobei.com</usemethod>");
	// strbuf.append("<fullcostsite>http://www.guajibaobei.com/chongzhi.htm</fullcostsite>");
	// strbuf.append("<proare>中国</proare>");
	// strbuf.append("<serviceNum>%C8%E7%B9%FB%C4%FA%D4%DA%B9%BA%C2%F2%D6%D0%D3%D0%CE%CA%CC%E2%C7%EB%BA%CD%CE%D2%C3%C7%C1%AA%CF%B5%A3%BA%0D%0A%BF%CD%B7%FEQQ%A3%BA393462%0D%0A%B5%E7%BB%B0%A3%BA025-52255777%0D%0Aemail%A3%Baservice%40ofcard.com+%0D%0A%C8%E7%D3%F6%B5%BD%B9%D9%B7%BD%CD%A3%D6%B9%B7%FE%CE%F1%A3%AC%B1%BE%CF%B5%CD%B3%B2%BB%B3%D0%B5%A3%C8%CE%BA%CE%D4%F0%C8%CE%A1%A3</serviceNum>");
	// strbuf.append("</card>");
	//
	// strbuf.append("<card>");
	// strbuf.append("<cardid>220612</cardid>");
	// strbuf.append("<pervalue>1</pervalue>");
	// strbuf.append("<inprice>0.95</inprice>");
	// strbuf.append("<sysddprice>0.95</sysddprice>");
	// strbuf.append("<sysdd1price>0.945</sysdd1price>");
	// strbuf.append("<sysdd2price>0.94</sysdd2price>");
	// strbuf.append("<memberprice>0.96</memberprice>");
	//
	// strbuf.append("<innum>240</innum>");
	// strbuf.append("<cardname>Q币按元直充(点击购买更多面值)</cardname>");
	// strbuf.append("<othername>Q币按元直充</othername>");
	// strbuf.append("<howeasy>A</howeasy>");
	// strbuf.append("<amounts>1-10,15</amounts>");
	// strbuf.append("<classtype>2</classtype>");
	// strbuf.append("<fullcostsite> http://qb.qq.com/</fullcostsite>");
	// strbuf.append("<caption>q%B1%D2%B3%E4%D6%B5%CD%F8%D5%BE%CC%DA%D1%B6%B9%D9%CD%F8%28qq.com%29%CA%C7%D6%D0%B9%FA%D7%EE%D4%E7%B5%C4%BB%A5%C1%AA%CD%F8%BC%B4%CA%B1%CD%A8%D0%C5%C8%ED%BC%FE%BF%AA%B7%A2%C9%CC%A3%AC%CA%C7%D6%D0%B9%FA%B5%C4%BB%A5%C1%AA%CD%F8%B7%FE%CE%F1%BC%B0%D2%C6%B6%AF%D4%F6%D6%B5%B7%FE%CE%F1%B9%A9%D3%A6%C9%CC%A3%AC%B2%A2%D2%BB%D6%B1%D6%C2%C1%A6%D3%DA%BC%B4%CA%B1%CD%A8%D0%C5%BC%B0%CF%E0%B9%D8%D4%F6%D6%B5%D2%B5%CE%F1%B5%C4%B7%FE%CE%F1%D4%CB%D3%AA%A1%A3%CC%DA%D1%B6%D2%D1%D0%CE%B3%C9%B8%F6%C8%CB%BC%B4%CA%B1%CD%A8%D0%C5%A1%A2%C6%F3%D2%B5%CA%B5%CA%B1%CD%A8%D0%C5%BA%CD%D3%E9%C0%D6%D7%CA%D1%B6%B5%C8%C8%FD%B4%F3%D5%BD%C2%D4%B7%A2%D5%B9%B7%BD%CF%F2%A3%AC%D5%FD%D6%F0%B2%BD%CA%B5%CF%D6%A1%B0%B4%B4%D2%BB%C1%F7%BB%A5%C1%AA%CD%F8%C6%F3%D2%B5%A1%B1%B5%C4%D4%B6%BE%B0%C4%BF%B1%EA%A1%A3+%3CBR%3E%B9%BA%C2%F2%CA%B1%C7%EB%D7%A2%D2%E2%D5%FD%C8%B7%CA%E4%C8%EB%C4%FA%B5%C4QQ%BA%C5%C2%EB%2C%D2%BB%B8%F6QQ%BA%C5%C2%EB%D2%BB%CC%EC%D7%EE%B6%E0%BF%C9%D2%D4%B3%E4%D6%B55000Q%B1%D2%A3%AC%B5%A5%B4%CE%B3%E4%D6%B5%B2%BB%C4%DC%B3%AC%B3%F6500Q%B1%D2%A1%A3 </caption>");
	// strbuf.append("<memberprice>0.96</memberprice>");
	//
	// strbuf.append("<lastreftime> 2008-06-10 09:46:46 </lastreftime>");
	// strbuf.append("<accountdesc>腾讯QQ号</accountdesc>");
	//
	// strbuf.append("</card>");
	// strbuf.append("</ret_cardinfos>");
	// strbuf.append("</cardinfo>");

	// String xmlStr = strbuf.toString().trim();
	// System.out.println(xmlStr);
	// parseXmlOfDirectRechargeString(xmlStr);
	// }

}
